package com.control.qct.businesssteward.utils;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.control.qct.businesssteward.R;

/**
 * Created by Administrator on 2018/3/28 0028.
 */

public class GlideUtil {
    public static void loadImage(Context context, String url, ImageView view) {
        Glide.with(context).load(url).into(view);
        if (TextUtils.isEmpty(url)) {
            Glide.with(context).clear(view);
            view.setImageResource(R.drawable.icon_placeholder);
        }
    }
    public static void loadImage(Activity context, String url, ImageView view) {
        Glide.with(context).load(url).into(view);
        if (TextUtils.isEmpty(url)) {
            Glide.with(context).clear(view);
            view.setImageResource(R.drawable.icon_placeholder);
        }
    }
    public static void loadImage(Fragment context, String url, ImageView view) {
        Glide.with(context).load(url).into(view);
        if (TextUtils.isEmpty(url)) {
            Glide.with(context).clear(view);
            view.setImageResource(R.drawable.icon_placeholder);
        }
    }
}
